import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:industry_net/base/common/colors_util.dart';
import 'package:industry_net/base/common/icon_util.dart';
import 'package:industry_net/base/common/size_fit.dart';
import 'package:industry_net/base/common/text_util.dart';
import 'package:industry_net/pages/home/search/controller.dart';

class SearchHistoryView extends StatelessWidget {
  SearchHistoryView({Key? key}) : super(key: key);
  final controller = Get.find<SearchController>();
  @override
  Widget build(BuildContext context) {
    return Container(
      // padding: EdgeInsets.symmetric(horizontal: gap12, vertical: gap10),
      padding: EdgeInsets.fromLTRB(gap12, gap10, gap12, 0),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Row(
            children: [
              Expanded(
                child: Text(
                  '搜索历史',
                  style: pfMediumStyle(
                      color: const Color(0xff888888), fontSize: 13.w),
                ),
              ),
              IconButton(
                  onPressed: () {},
                  icon: Icon(
                    IconUtil.delete,
                    color: const Color(0xffbbbbbb),
                    size: 14.w,
                  )),
            ],
          ),
          Wrap(
            spacing: 10.w,
            runSpacing: 10.w,
            children: controller.state.historyList
                .map((e) => InkWell(
                      child: Container(
                        padding: EdgeInsets.symmetric(
                            horizontal: gap12, vertical: 6.w),
                        height: 30.w,
                        decoration: BoxDecoration(
                            color: ColorsUtil.white,
                            borderRadius: BorderRadius.circular(15.w)),
                        child: Text(
                          e,
                          style: pfMediumStyle(
                              color: ColorsUtil.title, fontSize: font14),
                        ),
                      ),
                    ))
                .toList(),
          ),
          SizedBox(
            height: gap15,
          ),
          Container(
            height: 44.w,
            padding: EdgeInsets.symmetric(horizontal: gap12),
            decoration: const BoxDecoration(
                gradient: LinearGradient(
                    colors: [Color(0xfffff1de), ColorsUtil.white],
                    begin: Alignment.topCenter,
                    end: Alignment.bottomCenter)),
            child: Row(
              children: [
                Text(
                  '热搜榜',
                  style: pfMediumStyle(
                      color: const Color(0xff9d7047), fontSize: font15),
                )
              ],
            ),
          )
        ],
      ),
    );
  }
}
